import { request } from '@/axios/index.js'

// 获取文档列表
export const getDocList = (data) => {
  return request.get({
    url: '/doc/list',
    params: data
  })
}

// 获取所有文档列表
export const getDocAll = (ebookId) => {
  return request.get({
    url: '/doc/all/' + ebookId
  })
}

// 更新或新增文档
export const saveDoc = (data) => {
  return request.post({
    url: '/doc/save',
    data: data
  })
}

// 删除文档
export const deleteDoc = (ids) => {
  return request.delete({
    url: '/doc/delete/' + ids.join(',')
  })
}

// 根据文档id获取文档内容
export const getContent = (id) => {
  return request.get({
    url: '/doc/find-content/' + id
  })
}

// 点赞文档内容
export const vote = (id) => {
  return request.get({
    url: '/doc/vote/' + id,
    showLoading: false
  })
}
